//
//  ViewController.m
//  UI04_触摸_手势
//
//  Created by Scott on 16/5/6.
//  Copyright © 2016年 Scott. All rights reserved.
//

#import "ViewController.h"
#import "TouchView.h"
#import "RainbowView.h"
#import "GestureView.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.view.backgroundColor = [UIColor whiteColor];
 
    [self createSubViews];
    [self createGestureView];
}

#pragma mark - 知识点1: touch事件
/** 
 * touch就是触摸. 当我们touch一个View的时候, 会调用View父类UIResponder关于touch的四个相关方法.
 * 
 * 详见 TouchView 类.
 */
- (void)createSubViews {
    
    TouchView *viewOfRed = [[TouchView alloc] initWithFrame:CGRectMake(20, 20, 100, 100)];
    [self.view addSubview:viewOfRed];
    [viewOfRed release];
    
    viewOfRed.backgroundColor = [UIColor redColor];
    
    RainbowView *rainView = [[RainbowView alloc] initWithFrame:CGRectMake(100, 100, 200, 200) numberOfView:5 duration:0.5];
    [self.view addSubview:rainView];
    [rainView release];
    
    
}

#pragma mark - 知识点2: 响应者链
/** 
 * UIView 有个userInterActionEnable属性(用户交互)可以断开响应者链.使其无法检查.
 * UILabel, UIImageView 特殊, 默认用户交互是关闭的.
 */

#pragma mark - 知识点3: 手势. 
/** 
 * 详见 GestureView 类
 */

- (void)createGestureView {
    
    GestureView *view = [GestureView gestureViewWithFrame:CGRectMake(0, 0, 200, 300) image:[UIImage imageNamed:@"4.jpg"]];
    
    view.center = self.view.center;
    
    [self.view addSubview:view];
    
    
}




#pragma mark - 知识点4: UIView的transform属性.
/** 
 * transform属性 设置视图的缩放, 旋转, 移动.
 * 详见 GestureView 类.
 */





@end
